package com.kerbores.jfinal.service;

import java.util.Random;

import com.kerbores.jfinal.model.User;
import com.kerbores.utils.common.StringGener;

/**
 * @author 王贵源
 *
 *         create at 2014年9月23日 下午1:52:47
 */
public class UserService {

	private StringGener sg = new StringGener();

	private Random r = new Random();

	/**
	 * 
	 */
	private UserService() {
	}

	// private User userDao = User.dao;

	public static UserService me() {
		return new UserService();
	}

	/**
	 * @return
	 * 
	 */
	public boolean testTx() {

		boolean flag = new User().set("name", sg.next(10)).set("age", r.nextInt(10) + 20).save();
		if (r.nextBoolean()) {
			return flag;
		}
		throw new RuntimeException("msg");
	}
}
